const CloudDBZoneWrapper = require("./CloudDBZoneWrapper");
let myHandler = async function (event, context, callback, logger) {
  logger.info(event);
  let data;
  const cloudDBZoneWrapper = new CloudDBZoneWrapper(logger);
  if (event.body) {
    let body = JSON.parse(event.body);
    data = body.extraData;
  } else {
    data = event.extraData;
  }
  logger.info(`data: ${JSON.stringify(data)}`);
  let queryResult = await cloudDBZoneWrapper.queryAllByParam(data);
  logger.info(`result: ${JSON.stringify(queryResult)}`);
  callback({
    code: 0,
    desc: "Success.",
    data: queryResult
  });
};

export { myHandler };